#ifdef JARVSPEECH
#include "SpeechCore.h"
#include "StringUtil.h"
//#include <sphelper.h>
SK

SpeechCore::SpeechCore ()
: voice (NULL)
{
	HRESULT hr = ::CoCreateInstance (CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&voice);
	
	/*hr = ::CoCreateInstance (CLSID_SpInprocRecognizer, NULL, CLSCTX_ALL,IID_NULL,(void **)&recog );
	
	hr = SpGetDefaultTokenFromCategoryId (SPCAT_AUDIOIN, &inputToken);
	hr = recog->CreateRecoContext (&this->cont);
	
	ULONGLONG intr = SPFEI(SPEI_PHRASE_START) | SPFEI(SPEI_RECOGNITION) |  SPFEI(SPEI_FALSE_RECOGNITION);
	cont->SetInterest (intr,intr);

	this->cont->WaitForNotifyEvent (INFINITE);
	eve.GetFrom (cont);
	*/
}

SpeechCore::~SpeechCore()
{
	if (voice)
		voice->Release();

	//if (recog)
		//recog->Release();
}


void SpeechCore::speak (const String& text)
{
	ULONG strm = 0;
	StringW txt = StringUtil::makeUnicode (text);
	HRESULT ret = voice->Speak (txt.c_str(), SPF_IS_XML | SPF_ASYNC, NULL);

}

EK
#endif